//shot.js

function Shot(I) {
  I.active = true;

  I.xVelocity = 0;
  I.yVelocity = -I.speed;
  I.width = 3;
  I.height = 3;
  I.color = "#000";     //black

  //Shot inBounds
  I.inBounds = function () {
    return I.x >= 0 && I.x <= CANVAS_WIDTH &&
      I.y >= 0 && I.y <= CANVAS_HEIGHT;
  };

  //Shot draw
  I.draw = function () {
    canvas.fillStyle = this.color;
    canvas.fillRect(this.x, this.y, this.width, this.height);
  };

  //Shot update
  I.update = function () {
    I.x += I.xVelocity;
    I.y += I.yVelocity;

    I.active = I.active && I.inBounds();
  };

  //Shot explode
  I.explode = function () {		//hit causes shot to explode
    this.active = false;
  };

  return I;
}   //SHOT